#include <stdio.h>

/*搜索插入位置*/

int searchinsert(int* nums,int numsSize,int target)
{
   
    int left=0,right=numsSize-1;
    while(left<=right)
    {
        int mid=(left+right)/2;
        if(left==right)
        {
            return target>nums[left]? left+1:left;
        }
         if(nums[mid]==target)
        {
            return mid;
        }
        else if(nums[mid]>target)
        right=mid;
        else if(nums[mid]<target)
        left=mid+1;
        
    }
   return -1;
}



void main()
{
    int nums[]={1,3,5,7,11,13};
    int b;
    printf("please enter: ");
    scanf("%d",&b);

    printf("%d\n",searchinsert(nums,sizeof(nums)/4,b));
}